
import { StyleValue } from "vue";
import type { LowCodeConf, LowcodeGridRowColComponents, LowCodeInfo, LowcodeMdInfo, LowcodeMenuCFG, LowcodeMenuItemCFG, LowcodePage, LowcodePagePanel, LowcodePagePanelComponentItem, LowcodeRect } from "../interface";
import type { LowcodeTableSaveData } from "../hooks/interface";

export interface FetchMdBillDetailProxy {
  isOnLoad?: boolean;
}

export interface validateErrorItem { oldVal: any; newVal: any; msg: string };

export interface MdBillDetailProps {
  billId?: string;
  LowcodeGuid: string;
  LowcodeDetailGuid: string;
  parentType?: string; // approveManger 待审批打开的本页面
  mdInfo?: string;
};

export interface MdDetailBasicState {
  systemInfo?:  { [key: string]: any };
  lowcodeInfo?: LowCodeInfo;
  menusCFG?: LowcodeMenuItemCFG[];
  menusCFGMore?: any[];
  mainFormData?: { [key: string]: any };
  otherPanelData?: { [key: string]: any };
  enableRowDelete?: boolean;
  navWrapRect?: LowcodeRect;
  mainCardStyle?: StyleValue;
  mainCellProps?: { [key: string]: any };
  createPopupStyle?: StyleValue;
  cIdConf?: LowcodePagePanelComponentItem;
  subCardFormPanels?: { [key: string]: LowcodeGridRowColComponents[] };
  subCellProps?: { [key: string]: any };
  otherPanelConf?: LowcodeGridRowColComponents;
  cellProps?: { [key: string]: any };
  enableApprove?: boolean;
  mdInfo?: LowcodeMdInfo;
  c_menuCFG?: LowcodeMenuItemCFG[];
};

export interface MdBillDetailState extends MdDetailBasicState {
  // detailPage?: LowcodePage;
  mainComponents?: LowcodePagePanelComponentItem[];
  mainFormPanel?: LowcodeGridRowColComponents;
  // otherPanelConf?: LowcodeGridRowColComponents; // { [key: string]: LowcodeGridRowColComponents };
  // otherPanelData?: any[]; // { [key: string]: any[] };
  // subCardFormData?: { [key: string]: any };
  approveStyle?: StyleValue;
};

export interface MdEditDetailState extends MdDetailBasicState {
  editWrapStyle?: StyleValue;
  mainFormPanel?: LowcodePagePanel;
  mainComponentConf?: { [key: string]: LowcodePagePanelComponentItem };
  otherComponentConf?: { [key: string]: LowcodePagePanelComponentItem };
  mainCardTitle?: string;
  otherCardTitle?: string;
  mainSubFormData?: { [key: string]: { [key: string]: any } };
  // mainSubCardFormPanels?: LowcodePagePanel[];
  otherPanelShow?: LowcodePagePanel;
  otherSubPanelsShow?: LowcodePagePanel[];
  initOtherPanelDataObj?: { [key: string]: any };
  popupData?: { [key:string]: any };
  pageTitle?: string;
  editTbIdx?: number;
  editTbRowData?: { [key:string]: any };
  tableSaveData: LowcodeTableSaveData;
  validateErrorDataPage?: { [key:string]: validateErrorItem };
  validateErrorDataPop?: { [key:string]: validateErrorItem };
  initMainFormData?: { [key:string]: any };
  initOtherPanelData?: { [key:string]: any };
  billIdAfterSave?: string;
  subPanelsEditFields?: { [key: string]: { [key: string]: LowcodePagePanelComponentItem } };
}

export interface BillDetailFetchRes extends LowCodeConf {};

export interface BillDetailFetchReq {
  LowcodeGuid: string;
  LowcodeDetailGuid: string;
};

export interface FetchDetailDataReq {
  BillId?: string;
}

export interface FetchDetailDataRes {
  [key: string]: any[]
}
